import wpath
import brownie
from brownie import *
import os

current_project = brownie.project.ProxyContractsProject


# 准备账户,所有窗口都要先运行以下定义账户代码
admin = a[0]
user = a[1]
from_admin = {"from": admin}
from_user = {"from": user}

import json
from brownie import web3


result_file = os.path.join(wpath.workspace(), "scripts/result.json")


def writeJson(data, path=result_file):
    with open(path, "w") as f:
        json.dump(data, f)


def loadJson(path=result_file):
    with open(path, "r") as load_f:
        data = json.load(load_f)
    return data


def getBalanceEth(address):
    balance = web3.eth.getBalance(address)
    return web3.fromWei(balance, "ether")
